#include<bits/stdc++.h>
using namespace std;
long long n,a[1000009],b[1000009],c[1000009];
double d[1000009],mx,ans;
int main(){
    freopen("wan.in","r",stdin);
    freopen("wan.out","w",stdout);
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld%lld",a+i,b+i,c+i);
        mx=0;
        for(int j=1;j<i;j++){
            if(b[i]>c[j])mx=max(mx,d[j]+a[j]);
            else{
                mx=max(mx,d[j]);
                // cout<<d[j]<<" "<<d[j]+1.0*a[j]*(b[i]-b[j])/(c[j]-b[j])<<" "<<d[j]+a[j]-1.0*a[i]*(c[j]-b[i])/(c[i]-b[i])<<endl;
                if(b[i]>=b[j])mx=max(mx,d[j]+1.0*a[j]*(b[i]-b[j])/(c[j]-b[j]));
                if(c[j]<=c[i])mx=max(mx,d[j]+1.0*a[j]-1.0*a[i]*(c[j]-b[i])/(c[i]-b[i]));
            }
        }
        d[i]=mx;
        ans=max(ans,d[i]+a[i]);
        // cout<<i<<" "<<d[i]<<" "<<d[i]+a[i]<<endl;
    }
    printf("%.12lf\n",ans);
    return 0;
}